package teaching.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import teaching.pojo.CourseComment;

import java.util.List;

/**
 * Author:20201002983_郑雨蓓
 * Date: 2024/4/15
 * Description:
 */
public interface CourseCommentMapper {
    @Select("select cc.*,s.avatar as avatar from course_comment cc,student s where course_id=#{cid} and cc.student_username=s.username;")
    List<CourseComment> getAll(@Param("cid") long cid);

    @Insert("insert into course_comment(course_id, student_username, content, create_time) values (#{comment.courseId},#{comment.studentUsername},#{comment.content},#{comment.createTime})")
    int addComment(@Param("comment") CourseComment comment);
}
